#include "util.h"


using namespace std;


unsigned int Util_RGB(unsigned char r, unsigned char g, unsigned char b)
{
	return ((((unsigned char) r) << 16) | (((unsigned char) g) << 8) | ((unsigned char) b)) | 0xff000000;
}


string Util_popNextToken(string& str, const string& delimiters)
{
	unsigned int i = str.find_first_not_of(delimiters + " \t");
	if (i != string::npos)
	{
		str.erase(0, i);
	}

	i = str.find_first_of(delimiters);
	if (i == string::npos)
	{
		i = str.length();
	}

	string token = str.substr(0, i);
	str.erase(0, i);

	i = token.find_last_not_of(" \t");
	if (i < token.length() - 1)
	{
		token.erase(i + 1, token.length() - i);
	}

	return token;
}
